package com.ms.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ms.entity.Organizer;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface OrganizerMapper extends BaseMapper<Organizer> {
    // 根据账号查询举办方（用于注册时判断账号是否已存在）
    @Select("SELECT * FROM organizer WHERE or_account = #{account}")
    Organizer selectByAccount(String account);

    // 根据账号和密码查询（用于登录）
    @Select("SELECT * FROM organizer WHERE or_account = #{account} AND or_password = #{password}")
    Organizer selectByAccountAndPassword(@Param("account") String account, @Param("password") String password);

    // 更新密码
    @Update("UPDATE organizer SET or_password = #{newPassword} WHERE or_account = #{account}")
    int updatePassword(@Param("account") String account, @Param("newPassword") String newPassword);
}